<!--已审核成绩修改-->
<template>
  <div class="wrapper-container" style="display: flex; flex-direction: column">
    <div
      class="search-container"
      style="margin-bottom: 20px;justify-content: space-between;"
    >
      <div class="search-container-left">
        <div style="display:flex;align-items: baseline;">
          <span style="color:#004ca7;margin-right:10px;font-weight: bolder;"
            >2021学期  英语课程  主修成绩类型  未录20人</span>
         
        </div>
      </div>

    </div>
    <div class="table-container">
 

      <el-table
        :data="tableData"
        :span-method="arraySpanMethod"
        border
        style="width: 100%"
        class="table-data"
        row-class-name="row-class"
        cell-class-name="cell-class"
        header-row-class-name="header-row-class"
        header-cell-class-name="header-cell-class"
      >
        <el-table-column
          prop="numName"
          width="200"
          label="序号"
          align="center"
        >
        </el-table-column>
     
        <el-table-column prop="modifier" label="队别" align="center">
        </el-table-column>
        <el-table-column
          prop="modificationTime"
          label="年级"
          align="center"
        >
        </el-table-column>
        <el-table-column
          prop="HomeworkScores"
          label="专业"
          align="center"
        >
        </el-table-column>
        <el-table-column
          prop="classroomScores"
          label="学号"
          align="center"
        >
        </el-table-column>
        <el-table-column
          prop="midtermExamResults"
          label="姓名"
          align="center"
        >
          
        </el-table-column>
       
      </el-table>
    </div>
  </div>
</template>

<script>
import ButtonItem from "../../../components/ButtonItem.vue";

export default {
  components: {
    ButtonItem,
  },
  name: "supervisonMain",
  data() {
    return {
      checkList: [],
   
      record: 0,
      tableData: [
        {
          numName: "1",
          modifier: "2021级",
          modificationTime: "外语",
          HomeworkScores: "队别1",
          classroomScores: "23231212",
          midtermExamResults: "张三",
        },
        {
          numName: "2",
          modifier: "2021级",
          modificationTime: "外语",
          HomeworkScores: "队别1",
          classroomScores: "1213312",
          midtermExamResults: "张三",
        },
     
      ],
      setName: "",
    };
  },
  created() {
    this.mergeRow();
  },
  mounted() {},
  methods: {
    arraySpanMethod({ row, column }) {
      const span = column["property"] + "-span";
      if (row[span]) {
        return row[span];
      }
    },
    choiceLink(index) {
      this.record = index;
    },
    checkboxChange(e) {
      console.log(e);
    },

    isEmpty(val) {
      return typeof val == "undefined" || val === null || val == "-";
    },
    isObject(val) {
      return Object.prototype.toString.call(val) === "[object Object]";
    },
    mergeRow() {
      let arr = [].concat(this.tableData);
      // arr.splice(index, 0, Object.assign({}, row))

      this.tableData = this.mergeData(arr);
    },
    mergeData(list) {
      // mergeTarge - 合并项依据
      // combineProp - 根据mergeTarge 进行合并的单元格属性
      return this.filterData(this.config, [].concat(list));
    },
    filterData(config, tableData, targetProp) {
      const { mergeTarget, combineProp } = config;
      // 叠加的合并条件
      combineProp.forEach((column) => {
        // 记录合并项
        let combineCount = 1;
        if (this.isObject(column)) {
          return this.filterData.call(this, column, tableData, mergeTarget);
        }
        // 使用倒序遍历
        for (let i = tableData.length - 1; i >= 0; i--) {
          let curr = tableData[i],
            prev = tableData[i - 1];

          if (this.isEmpty(prev)) {
            // 已经循环完毕
            curr[`${column}-span`] = {
              rowspan: combineCount,
              colspan: combineCount >= 1 ? 1 : 0,
            };
            break;
          }

          if (
            prev[targetProp] === curr[targetProp] &&
            prev[mergeTarget] === curr[mergeTarget] &&
            prev[`${column}`] === curr[`${column}`]
          ) {
            ++combineCount;
            curr[`${column}-span`] = {
              rowspan: 0,
              colspan: 0,
            };
          } else {
            curr[`${column}-span`] = {
              rowspan: combineCount,
              colspan: combineCount >= 1 ? 1 : 0,
            };
            prev[`${column}-span`] = {
              rowspan: 1,
              colspan: 1,
            };
            // 前后项不相符时，对combinecount进行重置
            combineCount = 1;
          }
        }
      });
      return tableData;
    },
  },
  computed: {}, //计算属性
};
</script>

<style lang="less" scoped>
@import "../../../styles/supervision.less";

.wrapper-container {
  width: 1711px;
  margin: 0 auto;
}

/deep/ .table-container {
  .el-table td,
  .el-table th.is-leaf,
  .el-table--border,
  .el-table--group {
    border-color: #c7d7eb;
  }

  .el-table__header tr,
  .el-table__header th {
    padding: 0;
    height: 76px;
    background-color: #edf2f9;
    font-size: 16px;
    font-family: Microsoft YaHei;
    font-weight: bold;
    line-height: 20px;
    color: #004ca7;
  }

  .el-table__body tr,
  .el-table__body td {
    padding: 0;
    height: 86px;
  }

  .wrapper-button {
    display: flex;
    flex-direction: column;
    align-items: center;

    > div {
      margin-bottom: 8px;
    }
  }
  .table-data {
    width: 100%;
    border: 0.8px solid #004ca7;
    border-radius: 9px;
    font-size: 14px;
    font-family: Microsoft YaHei;
    font-weight: 400;
    color: #004ca7;
  }
}

.wrapper-container .search-container .search-container-left {
  flex-wrap: wrap;
  .search-container-item {
    width: 12%;
    margin-right: 0px;
    .box {
      > span {
        text-align: left;
      }
      display: flex;
      justify-content: space-evenly;
      margin-bottom: 20px;
      align-items: center;
    }
  }
}

/deep/.el-date-editor.el-input {
  width: 110px;
}
/deep/ .el-input--medium {
  width: 110px;
  .el-input__inner {
    height: 28px;
    width: 110px;
    padding: 0px 18px;
  }
}
/deep/ .el-table thead {
  color: #004ca7 !important;
}

.btn {
  margin-top: 271px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 271px;
  .submit {
    width: 84px;
    height: 27px;
    line-height: 8px;
  }
}
.bottom-block {
  display: flex;
  flex-direction: row;
  justify-content: space-between !important;
  .export-button {
    width: 127px;
    height: 27px;
    background: #fff6ef;
    border: 1px solid #f3b815;
    border-radius: 4px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    margin-top: 14px;
    > img {
      width: 17px;
      height: 17px;
    }
    > span {
      margin-left: 12px;
      font-size: 14px;
      font-family: Microsoft YaHei;
      font-weight: 400;
      color: #f3b815;
    }
  }
  .text {
    font-size: 14px;
    font-family: Microsoft YaHei;
    font-weight: 400;
    line-height: 39px;
    color: #004ca7;
  }
}
</style>
